#@adminLayout() #define main()

<link href="#(ctx)/static/ajax/libs/jquery-ztree/3.5/css/default/zTreeStyle.css" rel="stylesheet"/>
<script src="#(ctx)/static/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js"></script>

<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse" id="searchbar">
				<form id="user-form">
					<div class="select-list">
						<ul> 
							<li>
								产权：
								<select name="c_pro" id="c_pro" onchange="changeInfo()" >
				           		  #for(data: getOrgInfo(c_pro))
				           		 	<option value="#(data.ccode)">#(data.cname)</option>
				           		  #end
				           		 </select>
							</li>
	                        <li>
	                     		 用户：<input type="text" name="cname" style="width:120px;"/>
								<input type="hidden" name="cdept" id="hf_dept"/>
	                        </li>
	                        
	                        <li>
	                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
	                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
	                        </li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="col-sm-12 select-table table-bordered">
			    <table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
	
	<script type="text/javascript">
		var prefix = "#(ctx)/sysuser";
		var cpost="#(cpost)";
		var c_pro="#(c_pro)";
		$(function() {
		    queryList();
		});
		
		function queryList() {
		    var options = {
		        url: prefix + "/list?cpost="+cpost,
	            uniqueId: "ccode",
	            sortName: "cname",
	            sortOrder: "asc",
	            modalName: "用户",
                showSearch: false,
                showRefresh: false,
                showColumns: false,
                showToggle: false,
	            columns: [{
	                checkbox: true
	            },{
						title: '序号',//标题  可不加,
	                    width:'50px',
						formatter: function (value, row, index) {
							return index+1;
						}
	             },
				{
                    field: 'cname',
                    title: '姓名',
                    width: '100px'
                },
				{
                    field: 'user_pos',
                    title: '工作职位',
                    width: '100px'
                },
				{
                    field: 'cbm',
                    title: '所属部门',
                    width: '60px'
                },
				{
                    field: 'ctel',
                    title: '电话',
                    width: '100px'
                },
				{
                    field: 'cphone',
                    title: '手机',
                    width: '100px'
                },
				{
                    field: 'cemail',
                    title: '邮箱',
                    width: '100px'
                }]
		    };
		    $.table.init(options);
			
		    $("#bootstrap-table").colResizable({
				liveDrag:true, 
				gripInnerHtml:"<div class='grip'></div>", 
				draggingClass:"dragging", 
	            resizeMode:'overflow'
	        });
		}


		function submitHandler() {
	        if ($.validate.form()) {
	        	var rows = $.table.selectColumns("ccode");
            	if (rows.length == 0) {
            	    $.modal.alertWarning("请至少选择一条记录");
            	    return;
            	}
	        	$.operate.save("#(ctx)/syspost/adduser", {ids:rows.join(),cpost:cpost,c_pro:c_pro});
	        }
	    }
	</script>
</body>
#end